/*************
* sleep.c -- provide unix style sleep function
*
*************/
#include <time.h>

/* gjm:
 * Acorn's compiler wants a |time_t *| argument to each |tim()|.
 * So we give it one, three times.
 */

int sleep(unsigned secs){
	long	start;
	long	check;
	long	finish;

	time((time_t*)&start);	/* gjm: cast */
	finish = start + (long) secs;
#ifdef DEBUG
	printf ("sleep for %d secs, stop sleeping at %ld\n", secs, finish);
	time((time_t*)&check);	/* gjm: cast */
	printf ("it is now %ld\n", check );
#endif
	for (;;) {
		time((time_t*)&check);	/* gjm: cast */
		if (check > finish)
			break;
	}
	return (0);
}
